﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace Wiki.Models
{
    [MetadataType(typeof(Wiki_Validation))]
    public partial class Wiki
    {
    }

    public class Wiki_Validation
    {
        [HiddenInput(DisplayValue = false)]
        public Guid WikiId { get; set; }

        [HiddenInput(DisplayValue = false)]
        public Guid BusinessUnitId { get; set; }

        [HiddenInput(DisplayValue = false)]
        public Guid WikiHomePageId { get; set; }

        [Required(ErrorMessage = "Wiki name is required.")]
        [Display(Name = "Name")]
        [StringLength(127, ErrorMessage = "Wiki name cannot be more than 127 characters.")]
        [DataType(DataType.Text)]
        public string WikiName { get; set; }
    }

    public class WikiCreate
    {
        [HiddenInput(DisplayValue = false)]
        public Guid WikiId { get; set; }

        [HiddenInput(DisplayValue = false)]
        public Guid BusinessUnitId { get; set; }

        [HiddenInput(DisplayValue = false)]
        public Guid WikiHomePageId { get; set; }

        [Required(ErrorMessage = "Wiki name is required.")]
        [Display(Name = "Name")]
        [StringLength(127, ErrorMessage = "Wiki name cannot be more than 127 characters.")]
        [DataType(DataType.Text)]
        public string WikiName { get; set; }

        [Required(ErrorMessage = "Page Name is required.")]
        [Display(Name = "Page Name (URL)")]
        [StringLength(127, ErrorMessage = "Page name cannot be more than 127 characters.")]
        public string PageName { get; set; }

        [Display(Name = "Meta Keywords")]
        [StringLength(255, ErrorMessage = "Meta Keywords cannot be more than 255 characters.")]
        [DataType(DataType.MultilineText)]
        public string MetaKeywords { get; set; }

        [Display(Name = "Meta Description")]
        [StringLength(255, ErrorMessage = "Meta description cannot be more than 255 characters.")]
        [DataType(DataType.MultilineText)]
        public string MetaDescription { get; set; }

        [Required(ErrorMessage = "You have to specify if this Page is included on Main Menu.")]
        [StringLength(1, ErrorMessage = "Can be only 1 character")]
        [Display(Name = "On Main Menu?")]
        public string OnMainMenuYN { get; set; }

        [Required(ErrorMessage = "You have to select who can view this page.")]
        [Display(Name = "Permission")]
        public Guid PermissionId { get; set; }

        [DataType(DataType.MultilineText)]
        [Display(Name = "Content")]
        [AllowHtml]
        public string ContentText { get; set; }
    }

    public class WikiPageUI : WikiCreate
    {

        [HiddenInput(DisplayValue = false)]
        public Guid WikiPageId { get; set; }

        [Required(ErrorMessage = "Title is required.")]
        [Display(Name = "Title")]
        [StringLength(127, ErrorMessage = "Title cannot be more than 127 characters.")]
        [DataType(DataType.Text)]
        public string Title { get; set; }
    }
}